package com.jinghua.treatment.controller;

import com.jinghua.treatment.entity.SysDiet;
import com.jinghua.treatment.service.SysDietService;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * 饮食情况控制器
 * Created by 王兴光 on 2018/3/26.
 */
@Controller
@RequestMapping("/diet")
public class SysDietController {

    @Resource
    private SysDietService dietService;

    @ApiOperation(value="根据饮食情况编号查询饮食情况信息")
    @GetMapping(value="/getDietById",params = {"dietId"})
    @ResponseBody
    public SysDiet findDietById(Integer dietId){return dietService.selectByPrimaryKey(dietId);};

    @ApiOperation(value="新增饮食情况信息")
    @GetMapping(value="/insertDiet")
    @ResponseBody
    public int insertDiet(SysDiet diet){return dietService.insert(diet);};

    @ApiOperation(value="更新饮食情况信息")
    @GetMapping(value="/updateDiet")
    @ResponseBody
    public int updateDiet(SysDiet diet){return dietService.updateByPrimaryKey(diet);};
}
